/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package swap;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

/**
 *
 * @author modesto
 */
public class Swap {
    
    private HashMap processos;
    
    public Swap()
    {
        this.processos = new HashMap();
    }
    
    public void putProcesso(int pid, ProcessoEmSwap processo)
    {
        processos.put(pid, processo);
    }
    
    public ProcessoEmSwap getProcesso(int pid)
    {
        return (ProcessoEmSwap)this.processos.remove(pid);
    }
    
    public void ps()
    {
        Iterator it = this.processos.entrySet().iterator();
        ProcessoEmSwap processo_em_swap;
        Processo processo;
        
        while (it.hasNext())
        {
            Map.Entry pairs = (Map.Entry)it.next();
            
            processo_em_swap = (ProcessoEmSwap)pairs.getValue();
            
            processo = processo_em_swap.processo;
                       
            System.out.println("s: \t" + processo.getId() + "\t" + processo.getEstado() + "\t" + processo.getTam());
        }
    }
    
}
